#define ElemType int

typedef struct ListNode List_Node;

#include "common.h"

int numDecodings(char* s);

int main()
{
	return 0;
}

int numDecodings(char* s)
{
	if (!(*s - '0')) return 0;
	if (!s[1]) return 1;

	int dp[3] = { 1, 1 };
	for (int i = 1; s[i]; i++) {
		dp[2] = 0;
		int a = s[i] - '0', b = (s[i - 1] - '0') * 10 + a;
		if (0 < a && a < 10) 	dp[2] = dp[1];
		if (10 <= b && b <= 26) dp[2] += dp[0];
		dp[0] = dp[1], dp[1] = dp[2];
	}
	return dp[2];
}
